package com.warm.pump.module.work.dao.gen;

import java.util.List;
import java.util.Map;
import java.util.Date;
import java.math.BigDecimal;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;

import com.warm.pump.frame.gen.bean.PageBean;
import com.warm.pump.frame.gen.util.TypeCast;
import com.warm.pump.frame.gen.exception.ServiceException;
import com.warm.pump.module.work.bean.po.gen.Work;
import com.warm.pump.module.work.mapper.gen.WorkMapper;
import com.warm.pump.module.work.bean.po.gen.WorkExample;
@Repository
public class WorkDao {
	// 日志对象
	private transient Log log = LogFactory.getLog(this.getClass());
	@Autowired
	private WorkMapper workMapper;

	// 增加一个后台Work表
	
	public boolean insert(Work work) {
		try {
			workMapper.insert(work);
			log.debug("后台Work表增加成功");
			return true;
		} catch (Exception e) {
			log.debug("后台Work表增加失败");
			throw new ServiceException("后台Work表增加失败",e);
		}
	}
	// 增加一个后台Work表Selective
	
	public boolean insertSelective(Work work) {
		try {
			workMapper.insertSelective(work);
			log.debug("后台Work表增加成功");
			return true;
		} catch (Exception e) {
			log.debug("后台Work表增加失败");
			throw new ServiceException("后台Work表增加失败",e);
		}
	}

	// 删除一个后台Work表
	
	public boolean deleteByPrimaryKey(Long id) {
		try{
			workMapper.deleteByPrimaryKey(id);
			log.debug("后台Work表删除成功");
			return true;
		} catch(Exception e){
			log.debug("后台Work表删除失败");
			throw new ServiceException("后台Work表删除失败",e);
		}
	}
	// 删除一个后台Work表byMap
	
	public boolean deleteByMap(Map workMap) {
		try{
			workMapper.deleteByExample(createWorkExample(workMap,null,null));
			log.debug("后台Work根据Map删除成功");
			return true;
		}
		
		catch(Exception e){
			log.debug("后台Work根据GroupID删除失败");
			throw new ServiceException("后台Work根据object删除失败",e);
		}
	}
	// 修改一个后台Work表
	
	public boolean updateByPrimaryKey(Work work) {
		try{
			workMapper.updateByPrimaryKey(work);
			log.debug("后台Work表修改成功");
			return true;
		}
		
		catch(Exception e){
			log.debug("后台Work表修改失败");
			throw new ServiceException("后台Work表修改失败",e);
		}
	}
	// 修改一个后台Work表Selective
	
	public boolean updateByPrimaryKeySelective(Work work) {
		try{
			workMapper.updateByPrimaryKeySelective(work);
			log.debug("后台Work表修改成功");
			return true;
		}
		
		catch(Exception e){
			log.debug("后台Work表修改失败");
			throw new ServiceException("后台Work表修改失败",e);
		}
	}
	// 修改一个后台Work表
	
	public boolean updateByMap(Work work,Map workMap) {
		try{
			workMapper.updateByExample(work,createWorkExample(workMap,null,null));
			log.debug("后台批量Work表修改成功");
			return true;
		}
		catch(Exception e){
			log.debug("后台批量Work表修改失败");
			throw new ServiceException("后台Work表批量修改失败",e);
		}
	}
	// 修改一个后台Work表Selective
	
	public boolean updateByMapSelective(Work work,Map workMap) {
		try{
			workMapper.updateByExampleSelective(work,createWorkExample(workMap,null,null));
			log.debug("后台批量Work表修改成功");
			return true;
		}
		catch(Exception e){
			log.debug("后台批量Work表修改失败");
			throw new ServiceException("后台Work表批量修改失败",e);
		}
	}

	// 查询一个后台Work表
	
	public Work selectByPrimaryKey(Long id) {
		return workMapper.selectByPrimaryKey(id);
	}
	
	// 查询一个后台Work表-根据map
	
	public Work selectByMap(Map workMap) {
		List<Work> list = getListByMap(workMap);
		if(list==null||list.isEmpty()){
			return null;
		}else{
			return list.get(0);
		}
	}

	////////////////////////////////////////////////////////////////////////////////////////////////////////
	// 查询所有后台Work表
	
	public List<Work> getListByMap(Map workMap) {
		
		return workMapper.selectByExample(createWorkExample(workMap,null,null));
	}

	//统计后台Work表数量
	
	public int countTotalByMap(Map workMap) {
		
		return workMapper.countByExample(createWorkExample(workMap,null,null));
	}

	
	public List<Work> getListByMapPage(Map workMap, int limitStart,
			int limitOffset) {
		
		return workMapper.selectByExample(createWorkExample(workMap,limitStart,limitOffset));
	}
	
	
	public PageBean getPageBeanByMap(Map workMap,int pageNo,int pageSize) {
		Integer count = countTotalByMap(workMap);
		PageBean pageBean = new PageBean();
		pageBean.setCount(count);
		pageBean.setPageNo(pageNo);
		pageBean.setPageSize(pageSize);
		int limitStart = pageBean.getStartNo();
		int limitOffset = pageSize;
		pageBean.setData(workMapper.selectByExample(createWorkExample(workMap,limitStart,limitOffset)));
		return pageBean;
	}
		
	private WorkExample createWorkExample(Map workMap,Integer limitStart,Integer limitOffset){
			WorkExample workEx = new WorkExample();
			WorkExample.Criteria c = workEx.createCriteria();
				Long id_null = TypeCast.getLong(workMap.get("id_null"));
				Long id_notNull = TypeCast.getLong(workMap.get("id_notNull"));
				Long id = TypeCast.getLong(workMap.get("id"));
				Long id_not = TypeCast.getLong(workMap.get("id_not"));
				Long id_greater = TypeCast.getLong(workMap.get("id_greater"));
				Long id_greaterEqual = TypeCast.getLong(workMap.get("id_greaterEqual"));
				Long id_less = TypeCast.getLong(workMap.get("id_less"));
				Long id_lessEqual = TypeCast.getLong(workMap.get("id_lessEqual"));
				List<Long> id_in = TypeCast.getLongList(workMap.get("id_in"));
				List<Long> id_notIn = TypeCast.getLongList(workMap.get("id_notIn"));
				Long id_between1 = TypeCast.getLong(workMap.get("id_between1"));
				Long id_between2 = TypeCast.getLong(workMap.get("id_between2"));
				Long id_notBetween1 = TypeCast.getLong(workMap.get("id_notBetween1"));
				Long id_notBetween2 = TypeCast.getLong(workMap.get("id_notBetween2"));
				
				if(id_null != null){
					c.andIdIsNull();
				}
				if(id_notNull != null){
					c.andIdIsNotNull();
				}
				if(id != null){
					c.andIdEqualTo(id);
				}
				if(id_not != null){
					c.andIdNotEqualTo(id_not);
				}
				if(id_greater != null){
					c.andIdGreaterThan(id_greater);
				}
				if(id_greaterEqual != null){
					c.andIdGreaterThanOrEqualTo(id_greaterEqual);
				}
				if(id_less != null){
					c.andIdLessThan(id_less);
				}
				if(id_lessEqual != null){
					c.andIdLessThanOrEqualTo(id_lessEqual);
				}
				if(id_in != null){
					c.andIdIn(id_in);
				}
				if(id_notIn != null){
					c.andIdNotIn(id_notIn);
				}
				if(id_between1 != null){
					c.andIdBetween(id_between1,id_between2);
				}
				if(id_notBetween1 != null){
					c.andIdNotBetween(id_notBetween1,id_notBetween2);
				}
				String workName_null = TypeCast.getString(workMap.get("workName_null"));
				String workName_notNull = TypeCast.getString(workMap.get("workName_notNull"));
				String workName = TypeCast.getString(workMap.get("workName"));
				String workName_not = TypeCast.getString(workMap.get("workName_not"));
				String workName_greater = TypeCast.getString(workMap.get("workName_greater"));
				String workName_greaterEqual = TypeCast.getString(workMap.get("workName_greaterEqual"));
				String workName_less = TypeCast.getString(workMap.get("workName_less"));
				String workName_lessEqual = TypeCast.getString(workMap.get("workName_lessEqual"));
				String workName_like = TypeCast.getString(workMap.get("workName_like"));
				String workName_notLike = TypeCast.getString(workMap.get("workName_notLike"));
				List<String> workName_in = TypeCast.getStringList(workMap.get("workName_in"));
				List<String> workName_notIn = TypeCast.getStringList(workMap.get("workName_notIn"));
				String workName_between1 = TypeCast.getString(workMap.get("workName_between1"));
				String workName_between2 = TypeCast.getString(workMap.get("workName_between2"));
				String workName_notBetween1 = TypeCast.getString(workMap.get("workName_notBetween1"));
				String workName_notBetween2 = TypeCast.getString(workMap.get("workName_notBetween2"));
				
				if(workName_null != null){
					c.andWorkNameIsNull();
				}
				if(workName_notNull != null){
					c.andWorkNameIsNotNull();
				}
				if(workName != null){
					c.andWorkNameEqualTo(workName);
				}
				if(workName_not != null){
					c.andWorkNameNotEqualTo(workName_not);
				}
				if(workName_greater != null){
					c.andWorkNameGreaterThan(workName_greater);
				}
				if(workName_greaterEqual != null){
					c.andWorkNameGreaterThanOrEqualTo(workName_greaterEqual);
				}
				if(workName_less != null){
					c.andWorkNameLessThan(workName_less);
				}
				if(workName_lessEqual != null){
					c.andWorkNameLessThanOrEqualTo(workName_lessEqual);
				}
				if(workName_like != null){
					c.andWorkNameLike(workName_like);
				}
				if(workName_notLike != null){
					c.andWorkNameNotLike(workName_notLike);
				}
				if(workName_in != null){
					c.andWorkNameIn(workName_in);
				}
				if(workName_notIn != null){
					c.andWorkNameNotIn(workName_notIn);
				}
				if(workName_between1 != null){
					c.andWorkNameBetween(workName_between1,workName_between2);
				}
				if(workName_notBetween1 != null){
					c.andWorkNameNotBetween(workName_notBetween1,workName_notBetween2);
				}
				Long subjectId_null = TypeCast.getLong(workMap.get("subjectId_null"));
				Long subjectId_notNull = TypeCast.getLong(workMap.get("subjectId_notNull"));
				Long subjectId = TypeCast.getLong(workMap.get("subjectId"));
				Long subjectId_not = TypeCast.getLong(workMap.get("subjectId_not"));
				Long subjectId_greater = TypeCast.getLong(workMap.get("subjectId_greater"));
				Long subjectId_greaterEqual = TypeCast.getLong(workMap.get("subjectId_greaterEqual"));
				Long subjectId_less = TypeCast.getLong(workMap.get("subjectId_less"));
				Long subjectId_lessEqual = TypeCast.getLong(workMap.get("subjectId_lessEqual"));
				List<Long> subjectId_in = TypeCast.getLongList(workMap.get("subjectId_in"));
				List<Long> subjectId_notIn = TypeCast.getLongList(workMap.get("subjectId_notIn"));
				Long subjectId_between1 = TypeCast.getLong(workMap.get("subjectId_between1"));
				Long subjectId_between2 = TypeCast.getLong(workMap.get("subjectId_between2"));
				Long subjectId_notBetween1 = TypeCast.getLong(workMap.get("subjectId_notBetween1"));
				Long subjectId_notBetween2 = TypeCast.getLong(workMap.get("subjectId_notBetween2"));
				
				if(subjectId_null != null){
					c.andSubjectIdIsNull();
				}
				if(subjectId_notNull != null){
					c.andSubjectIdIsNotNull();
				}
				if(subjectId != null){
					c.andSubjectIdEqualTo(subjectId);
				}
				if(subjectId_not != null){
					c.andSubjectIdNotEqualTo(subjectId_not);
				}
				if(subjectId_greater != null){
					c.andSubjectIdGreaterThan(subjectId_greater);
				}
				if(subjectId_greaterEqual != null){
					c.andSubjectIdGreaterThanOrEqualTo(subjectId_greaterEqual);
				}
				if(subjectId_less != null){
					c.andSubjectIdLessThan(subjectId_less);
				}
				if(subjectId_lessEqual != null){
					c.andSubjectIdLessThanOrEqualTo(subjectId_lessEqual);
				}
				if(subjectId_in != null){
					c.andSubjectIdIn(subjectId_in);
				}
				if(subjectId_notIn != null){
					c.andSubjectIdNotIn(subjectId_notIn);
				}
				if(subjectId_between1 != null){
					c.andSubjectIdBetween(subjectId_between1,subjectId_between2);
				}
				if(subjectId_notBetween1 != null){
					c.andSubjectIdNotBetween(subjectId_notBetween1,subjectId_notBetween2);
				}
				String referType_null = TypeCast.getString(workMap.get("referType_null"));
				String referType_notNull = TypeCast.getString(workMap.get("referType_notNull"));
				String referType = TypeCast.getString(workMap.get("referType"));
				String referType_not = TypeCast.getString(workMap.get("referType_not"));
				String referType_greater = TypeCast.getString(workMap.get("referType_greater"));
				String referType_greaterEqual = TypeCast.getString(workMap.get("referType_greaterEqual"));
				String referType_less = TypeCast.getString(workMap.get("referType_less"));
				String referType_lessEqual = TypeCast.getString(workMap.get("referType_lessEqual"));
				String referType_like = TypeCast.getString(workMap.get("referType_like"));
				String referType_notLike = TypeCast.getString(workMap.get("referType_notLike"));
				List<String> referType_in = TypeCast.getStringList(workMap.get("referType_in"));
				List<String> referType_notIn = TypeCast.getStringList(workMap.get("referType_notIn"));
				String referType_between1 = TypeCast.getString(workMap.get("referType_between1"));
				String referType_between2 = TypeCast.getString(workMap.get("referType_between2"));
				String referType_notBetween1 = TypeCast.getString(workMap.get("referType_notBetween1"));
				String referType_notBetween2 = TypeCast.getString(workMap.get("referType_notBetween2"));
				
				if(referType_null != null){
					c.andReferTypeIsNull();
				}
				if(referType_notNull != null){
					c.andReferTypeIsNotNull();
				}
				if(referType != null){
					c.andReferTypeEqualTo(referType);
				}
				if(referType_not != null){
					c.andReferTypeNotEqualTo(referType_not);
				}
				if(referType_greater != null){
					c.andReferTypeGreaterThan(referType_greater);
				}
				if(referType_greaterEqual != null){
					c.andReferTypeGreaterThanOrEqualTo(referType_greaterEqual);
				}
				if(referType_less != null){
					c.andReferTypeLessThan(referType_less);
				}
				if(referType_lessEqual != null){
					c.andReferTypeLessThanOrEqualTo(referType_lessEqual);
				}
				if(referType_like != null){
					c.andReferTypeLike(referType_like);
				}
				if(referType_notLike != null){
					c.andReferTypeNotLike(referType_notLike);
				}
				if(referType_in != null){
					c.andReferTypeIn(referType_in);
				}
				if(referType_notIn != null){
					c.andReferTypeNotIn(referType_notIn);
				}
				if(referType_between1 != null){
					c.andReferTypeBetween(referType_between1,referType_between2);
				}
				if(referType_notBetween1 != null){
					c.andReferTypeNotBetween(referType_notBetween1,referType_notBetween2);
				}
				String referWorkId_null = TypeCast.getString(workMap.get("referWorkId_null"));
				String referWorkId_notNull = TypeCast.getString(workMap.get("referWorkId_notNull"));
				String referWorkId = TypeCast.getString(workMap.get("referWorkId"));
				String referWorkId_not = TypeCast.getString(workMap.get("referWorkId_not"));
				String referWorkId_greater = TypeCast.getString(workMap.get("referWorkId_greater"));
				String referWorkId_greaterEqual = TypeCast.getString(workMap.get("referWorkId_greaterEqual"));
				String referWorkId_less = TypeCast.getString(workMap.get("referWorkId_less"));
				String referWorkId_lessEqual = TypeCast.getString(workMap.get("referWorkId_lessEqual"));
				String referWorkId_like = TypeCast.getString(workMap.get("referWorkId_like"));
				String referWorkId_notLike = TypeCast.getString(workMap.get("referWorkId_notLike"));
				List<String> referWorkId_in = TypeCast.getStringList(workMap.get("referWorkId_in"));
				List<String> referWorkId_notIn = TypeCast.getStringList(workMap.get("referWorkId_notIn"));
				String referWorkId_between1 = TypeCast.getString(workMap.get("referWorkId_between1"));
				String referWorkId_between2 = TypeCast.getString(workMap.get("referWorkId_between2"));
				String referWorkId_notBetween1 = TypeCast.getString(workMap.get("referWorkId_notBetween1"));
				String referWorkId_notBetween2 = TypeCast.getString(workMap.get("referWorkId_notBetween2"));
				
				if(referWorkId_null != null){
					c.andReferWorkIdIsNull();
				}
				if(referWorkId_notNull != null){
					c.andReferWorkIdIsNotNull();
				}
				if(referWorkId != null){
					c.andReferWorkIdEqualTo(referWorkId);
				}
				if(referWorkId_not != null){
					c.andReferWorkIdNotEqualTo(referWorkId_not);
				}
				if(referWorkId_greater != null){
					c.andReferWorkIdGreaterThan(referWorkId_greater);
				}
				if(referWorkId_greaterEqual != null){
					c.andReferWorkIdGreaterThanOrEqualTo(referWorkId_greaterEqual);
				}
				if(referWorkId_less != null){
					c.andReferWorkIdLessThan(referWorkId_less);
				}
				if(referWorkId_lessEqual != null){
					c.andReferWorkIdLessThanOrEqualTo(referWorkId_lessEqual);
				}
				if(referWorkId_like != null){
					c.andReferWorkIdLike(referWorkId_like);
				}
				if(referWorkId_notLike != null){
					c.andReferWorkIdNotLike(referWorkId_notLike);
				}
				if(referWorkId_in != null){
					c.andReferWorkIdIn(referWorkId_in);
				}
				if(referWorkId_notIn != null){
					c.andReferWorkIdNotIn(referWorkId_notIn);
				}
				if(referWorkId_between1 != null){
					c.andReferWorkIdBetween(referWorkId_between1,referWorkId_between2);
				}
				if(referWorkId_notBetween1 != null){
					c.andReferWorkIdNotBetween(referWorkId_notBetween1,referWorkId_notBetween2);
				}
				String referSql_null = TypeCast.getString(workMap.get("referSql_null"));
				String referSql_notNull = TypeCast.getString(workMap.get("referSql_notNull"));
				String referSql = TypeCast.getString(workMap.get("referSql"));
				String referSql_not = TypeCast.getString(workMap.get("referSql_not"));
				String referSql_greater = TypeCast.getString(workMap.get("referSql_greater"));
				String referSql_greaterEqual = TypeCast.getString(workMap.get("referSql_greaterEqual"));
				String referSql_less = TypeCast.getString(workMap.get("referSql_less"));
				String referSql_lessEqual = TypeCast.getString(workMap.get("referSql_lessEqual"));
				String referSql_like = TypeCast.getString(workMap.get("referSql_like"));
				String referSql_notLike = TypeCast.getString(workMap.get("referSql_notLike"));
				List<String> referSql_in = TypeCast.getStringList(workMap.get("referSql_in"));
				List<String> referSql_notIn = TypeCast.getStringList(workMap.get("referSql_notIn"));
				String referSql_between1 = TypeCast.getString(workMap.get("referSql_between1"));
				String referSql_between2 = TypeCast.getString(workMap.get("referSql_between2"));
				String referSql_notBetween1 = TypeCast.getString(workMap.get("referSql_notBetween1"));
				String referSql_notBetween2 = TypeCast.getString(workMap.get("referSql_notBetween2"));
				
				if(referSql_null != null){
					c.andReferSqlIsNull();
				}
				if(referSql_notNull != null){
					c.andReferSqlIsNotNull();
				}
				if(referSql != null){
					c.andReferSqlEqualTo(referSql);
				}
				if(referSql_not != null){
					c.andReferSqlNotEqualTo(referSql_not);
				}
				if(referSql_greater != null){
					c.andReferSqlGreaterThan(referSql_greater);
				}
				if(referSql_greaterEqual != null){
					c.andReferSqlGreaterThanOrEqualTo(referSql_greaterEqual);
				}
				if(referSql_less != null){
					c.andReferSqlLessThan(referSql_less);
				}
				if(referSql_lessEqual != null){
					c.andReferSqlLessThanOrEqualTo(referSql_lessEqual);
				}
				if(referSql_like != null){
					c.andReferSqlLike(referSql_like);
				}
				if(referSql_notLike != null){
					c.andReferSqlNotLike(referSql_notLike);
				}
				if(referSql_in != null){
					c.andReferSqlIn(referSql_in);
				}
				if(referSql_notIn != null){
					c.andReferSqlNotIn(referSql_notIn);
				}
				if(referSql_between1 != null){
					c.andReferSqlBetween(referSql_between1,referSql_between2);
				}
				if(referSql_notBetween1 != null){
					c.andReferSqlNotBetween(referSql_notBetween1,referSql_notBetween2);
				}
				String misfire_null = TypeCast.getString(workMap.get("misfire_null"));
				String misfire_notNull = TypeCast.getString(workMap.get("misfire_notNull"));
				String misfire = TypeCast.getString(workMap.get("misfire"));
				String misfire_not = TypeCast.getString(workMap.get("misfire_not"));
				String misfire_greater = TypeCast.getString(workMap.get("misfire_greater"));
				String misfire_greaterEqual = TypeCast.getString(workMap.get("misfire_greaterEqual"));
				String misfire_less = TypeCast.getString(workMap.get("misfire_less"));
				String misfire_lessEqual = TypeCast.getString(workMap.get("misfire_lessEqual"));
				String misfire_like = TypeCast.getString(workMap.get("misfire_like"));
				String misfire_notLike = TypeCast.getString(workMap.get("misfire_notLike"));
				List<String> misfire_in = TypeCast.getStringList(workMap.get("misfire_in"));
				List<String> misfire_notIn = TypeCast.getStringList(workMap.get("misfire_notIn"));
				String misfire_between1 = TypeCast.getString(workMap.get("misfire_between1"));
				String misfire_between2 = TypeCast.getString(workMap.get("misfire_between2"));
				String misfire_notBetween1 = TypeCast.getString(workMap.get("misfire_notBetween1"));
				String misfire_notBetween2 = TypeCast.getString(workMap.get("misfire_notBetween2"));
				
				if(misfire_null != null){
					c.andMisfireIsNull();
				}
				if(misfire_notNull != null){
					c.andMisfireIsNotNull();
				}
				if(misfire != null){
					c.andMisfireEqualTo(misfire);
				}
				if(misfire_not != null){
					c.andMisfireNotEqualTo(misfire_not);
				}
				if(misfire_greater != null){
					c.andMisfireGreaterThan(misfire_greater);
				}
				if(misfire_greaterEqual != null){
					c.andMisfireGreaterThanOrEqualTo(misfire_greaterEqual);
				}
				if(misfire_less != null){
					c.andMisfireLessThan(misfire_less);
				}
				if(misfire_lessEqual != null){
					c.andMisfireLessThanOrEqualTo(misfire_lessEqual);
				}
				if(misfire_like != null){
					c.andMisfireLike(misfire_like);
				}
				if(misfire_notLike != null){
					c.andMisfireNotLike(misfire_notLike);
				}
				if(misfire_in != null){
					c.andMisfireIn(misfire_in);
				}
				if(misfire_notIn != null){
					c.andMisfireNotIn(misfire_notIn);
				}
				if(misfire_between1 != null){
					c.andMisfireBetween(misfire_between1,misfire_between2);
				}
				if(misfire_notBetween1 != null){
					c.andMisfireNotBetween(misfire_notBetween1,misfire_notBetween2);
				}
				Integer status_null = TypeCast.getInteger(workMap.get("status_null"));
				Integer status_notNull = TypeCast.getInteger(workMap.get("status_notNull"));
				Integer status = TypeCast.getInteger(workMap.get("status"));
				Integer status_not = TypeCast.getInteger(workMap.get("status_not"));
				Integer status_greater = TypeCast.getInteger(workMap.get("status_greater"));
				Integer status_greaterEqual = TypeCast.getInteger(workMap.get("status_greaterEqual"));
				Integer status_less = TypeCast.getInteger(workMap.get("status_less"));
				Integer status_lessEqual = TypeCast.getInteger(workMap.get("status_lessEqual"));
				List<Integer> status_in = TypeCast.getIntegerList(workMap.get("status_in"));
				List<Integer> status_notIn = TypeCast.getIntegerList(workMap.get("status_notIn"));
				Integer status_between1 = TypeCast.getInteger(workMap.get("status_between1"));
				Integer status_between2 = TypeCast.getInteger(workMap.get("status_between2"));
				Integer status_notBetween1 = TypeCast.getInteger(workMap.get("status_notBetween1"));
				Integer status_notBetween2 = TypeCast.getInteger(workMap.get("status_notBetween2"));
				
				if(status_null != null){
					c.andStatusIsNull();
				}
				if(status_notNull != null){
					c.andStatusIsNotNull();
				}
				if(status != null){
					c.andStatusEqualTo(status);
				}
				if(status_not != null){
					c.andStatusNotEqualTo(status_not);
				}
				if(status_greater != null){
					c.andStatusGreaterThan(status_greater);
				}
				if(status_greaterEqual != null){
					c.andStatusGreaterThanOrEqualTo(status_greaterEqual);
				}
				if(status_less != null){
					c.andStatusLessThan(status_less);
				}
				if(status_lessEqual != null){
					c.andStatusLessThanOrEqualTo(status_lessEqual);
				}
				if(status_in != null){
					c.andStatusIn(status_in);
				}
				if(status_notIn != null){
					c.andStatusNotIn(status_notIn);
				}
				if(status_between1 != null){
					c.andStatusBetween(status_between1,status_between2);
				}
				if(status_notBetween1 != null){
					c.andStatusNotBetween(status_notBetween1,status_notBetween2);
				}
				String remark_null = TypeCast.getString(workMap.get("remark_null"));
				String remark_notNull = TypeCast.getString(workMap.get("remark_notNull"));
				String remark = TypeCast.getString(workMap.get("remark"));
				String remark_not = TypeCast.getString(workMap.get("remark_not"));
				String remark_greater = TypeCast.getString(workMap.get("remark_greater"));
				String remark_greaterEqual = TypeCast.getString(workMap.get("remark_greaterEqual"));
				String remark_less = TypeCast.getString(workMap.get("remark_less"));
				String remark_lessEqual = TypeCast.getString(workMap.get("remark_lessEqual"));
				String remark_like = TypeCast.getString(workMap.get("remark_like"));
				String remark_notLike = TypeCast.getString(workMap.get("remark_notLike"));
				List<String> remark_in = TypeCast.getStringList(workMap.get("remark_in"));
				List<String> remark_notIn = TypeCast.getStringList(workMap.get("remark_notIn"));
				String remark_between1 = TypeCast.getString(workMap.get("remark_between1"));
				String remark_between2 = TypeCast.getString(workMap.get("remark_between2"));
				String remark_notBetween1 = TypeCast.getString(workMap.get("remark_notBetween1"));
				String remark_notBetween2 = TypeCast.getString(workMap.get("remark_notBetween2"));
				
				if(remark_null != null){
					c.andRemarkIsNull();
				}
				if(remark_notNull != null){
					c.andRemarkIsNotNull();
				}
				if(remark != null){
					c.andRemarkEqualTo(remark);
				}
				if(remark_not != null){
					c.andRemarkNotEqualTo(remark_not);
				}
				if(remark_greater != null){
					c.andRemarkGreaterThan(remark_greater);
				}
				if(remark_greaterEqual != null){
					c.andRemarkGreaterThanOrEqualTo(remark_greaterEqual);
				}
				if(remark_less != null){
					c.andRemarkLessThan(remark_less);
				}
				if(remark_lessEqual != null){
					c.andRemarkLessThanOrEqualTo(remark_lessEqual);
				}
				if(remark_like != null){
					c.andRemarkLike(remark_like);
				}
				if(remark_notLike != null){
					c.andRemarkNotLike(remark_notLike);
				}
				if(remark_in != null){
					c.andRemarkIn(remark_in);
				}
				if(remark_notIn != null){
					c.andRemarkNotIn(remark_notIn);
				}
				if(remark_between1 != null){
					c.andRemarkBetween(remark_between1,remark_between2);
				}
				if(remark_notBetween1 != null){
					c.andRemarkNotBetween(remark_notBetween1,remark_notBetween2);
				}
				Integer orderNum_null = TypeCast.getInteger(workMap.get("orderNum_null"));
				Integer orderNum_notNull = TypeCast.getInteger(workMap.get("orderNum_notNull"));
				Integer orderNum = TypeCast.getInteger(workMap.get("orderNum"));
				Integer orderNum_not = TypeCast.getInteger(workMap.get("orderNum_not"));
				Integer orderNum_greater = TypeCast.getInteger(workMap.get("orderNum_greater"));
				Integer orderNum_greaterEqual = TypeCast.getInteger(workMap.get("orderNum_greaterEqual"));
				Integer orderNum_less = TypeCast.getInteger(workMap.get("orderNum_less"));
				Integer orderNum_lessEqual = TypeCast.getInteger(workMap.get("orderNum_lessEqual"));
				List<Integer> orderNum_in = TypeCast.getIntegerList(workMap.get("orderNum_in"));
				List<Integer> orderNum_notIn = TypeCast.getIntegerList(workMap.get("orderNum_notIn"));
				Integer orderNum_between1 = TypeCast.getInteger(workMap.get("orderNum_between1"));
				Integer orderNum_between2 = TypeCast.getInteger(workMap.get("orderNum_between2"));
				Integer orderNum_notBetween1 = TypeCast.getInteger(workMap.get("orderNum_notBetween1"));
				Integer orderNum_notBetween2 = TypeCast.getInteger(workMap.get("orderNum_notBetween2"));
				
				if(orderNum_null != null){
					c.andOrderNumIsNull();
				}
				if(orderNum_notNull != null){
					c.andOrderNumIsNotNull();
				}
				if(orderNum != null){
					c.andOrderNumEqualTo(orderNum);
				}
				if(orderNum_not != null){
					c.andOrderNumNotEqualTo(orderNum_not);
				}
				if(orderNum_greater != null){
					c.andOrderNumGreaterThan(orderNum_greater);
				}
				if(orderNum_greaterEqual != null){
					c.andOrderNumGreaterThanOrEqualTo(orderNum_greaterEqual);
				}
				if(orderNum_less != null){
					c.andOrderNumLessThan(orderNum_less);
				}
				if(orderNum_lessEqual != null){
					c.andOrderNumLessThanOrEqualTo(orderNum_lessEqual);
				}
				if(orderNum_in != null){
					c.andOrderNumIn(orderNum_in);
				}
				if(orderNum_notIn != null){
					c.andOrderNumNotIn(orderNum_notIn);
				}
				if(orderNum_between1 != null){
					c.andOrderNumBetween(orderNum_between1,orderNum_between2);
				}
				if(orderNum_notBetween1 != null){
					c.andOrderNumNotBetween(orderNum_notBetween1,orderNum_notBetween2);
				}
				Date createTime_null = TypeCast.getDate(workMap.get("createTime_null"));
				Date createTime_notNull = TypeCast.getDate(workMap.get("createTime_notNull"));
				Date createTime = TypeCast.getDate(workMap.get("createTime"));
				Date createTime_not = TypeCast.getDate(workMap.get("createTime_not"));
				Date createTime_greater = TypeCast.getDate(workMap.get("createTime_greater"));
				Date createTime_greaterEqual = TypeCast.getDate(workMap.get("createTime_greaterEqual"));
				Date createTime_less = TypeCast.getDate(workMap.get("createTime_less"));
				Date createTime_lessEqual = TypeCast.getDate(workMap.get("createTime_lessEqual"));
				List<Date> createTime_in = TypeCast.getDateList(workMap.get("createTime_in"));
				List<Date> createTime_notIn = TypeCast.getDateList(workMap.get("createTime_notIn"));
				Date createTime_between1 = TypeCast.getDate(workMap.get("createTime_between1"));
				Date createTime_between2 = TypeCast.getDate(workMap.get("createTime_between2"));
				Date createTime_notBetween1 = TypeCast.getDate(workMap.get("createTime_notBetween1"));
				Date createTime_notBetween2 = TypeCast.getDate(workMap.get("createTime_notBetween2"));
				
				if(createTime_null != null){
					c.andCreateTimeIsNull();
				}
				if(createTime_notNull != null){
					c.andCreateTimeIsNotNull();
				}
				if(createTime != null){
					c.andCreateTimeEqualTo(createTime);
				}
				if(createTime_not != null){
					c.andCreateTimeNotEqualTo(createTime_not);
				}
				if(createTime_greater != null){
					c.andCreateTimeGreaterThan(createTime_greater);
				}
				if(createTime_greaterEqual != null){
					c.andCreateTimeGreaterThanOrEqualTo(createTime_greaterEqual);
				}
				if(createTime_less != null){
					c.andCreateTimeLessThan(createTime_less);
				}
				if(createTime_lessEqual != null){
					c.andCreateTimeLessThanOrEqualTo(createTime_lessEqual);
				}
				if(createTime_in != null){
					c.andCreateTimeIn(createTime_in);
				}
				if(createTime_notIn != null){
					c.andCreateTimeNotIn(createTime_notIn);
				}
				if(createTime_between1 != null){
					c.andCreateTimeBetween(createTime_between1,createTime_between2);
				}
				if(createTime_notBetween1 != null){
					c.andCreateTimeNotBetween(createTime_notBetween1,createTime_notBetween2);
				}
				Date updateTime_null = TypeCast.getDate(workMap.get("updateTime_null"));
				Date updateTime_notNull = TypeCast.getDate(workMap.get("updateTime_notNull"));
				Date updateTime = TypeCast.getDate(workMap.get("updateTime"));
				Date updateTime_not = TypeCast.getDate(workMap.get("updateTime_not"));
				Date updateTime_greater = TypeCast.getDate(workMap.get("updateTime_greater"));
				Date updateTime_greaterEqual = TypeCast.getDate(workMap.get("updateTime_greaterEqual"));
				Date updateTime_less = TypeCast.getDate(workMap.get("updateTime_less"));
				Date updateTime_lessEqual = TypeCast.getDate(workMap.get("updateTime_lessEqual"));
				List<Date> updateTime_in = TypeCast.getDateList(workMap.get("updateTime_in"));
				List<Date> updateTime_notIn = TypeCast.getDateList(workMap.get("updateTime_notIn"));
				Date updateTime_between1 = TypeCast.getDate(workMap.get("updateTime_between1"));
				Date updateTime_between2 = TypeCast.getDate(workMap.get("updateTime_between2"));
				Date updateTime_notBetween1 = TypeCast.getDate(workMap.get("updateTime_notBetween1"));
				Date updateTime_notBetween2 = TypeCast.getDate(workMap.get("updateTime_notBetween2"));
				
				if(updateTime_null != null){
					c.andUpdateTimeIsNull();
				}
				if(updateTime_notNull != null){
					c.andUpdateTimeIsNotNull();
				}
				if(updateTime != null){
					c.andUpdateTimeEqualTo(updateTime);
				}
				if(updateTime_not != null){
					c.andUpdateTimeNotEqualTo(updateTime_not);
				}
				if(updateTime_greater != null){
					c.andUpdateTimeGreaterThan(updateTime_greater);
				}
				if(updateTime_greaterEqual != null){
					c.andUpdateTimeGreaterThanOrEqualTo(updateTime_greaterEqual);
				}
				if(updateTime_less != null){
					c.andUpdateTimeLessThan(updateTime_less);
				}
				if(updateTime_lessEqual != null){
					c.andUpdateTimeLessThanOrEqualTo(updateTime_lessEqual);
				}
				if(updateTime_in != null){
					c.andUpdateTimeIn(updateTime_in);
				}
				if(updateTime_notIn != null){
					c.andUpdateTimeNotIn(updateTime_notIn);
				}
				if(updateTime_between1 != null){
					c.andUpdateTimeBetween(updateTime_between1,updateTime_between2);
				}
				if(updateTime_notBetween1 != null){
					c.andUpdateTimeNotBetween(updateTime_notBetween1,updateTime_notBetween2);
				}
				Long paramsId_null = TypeCast.getLong(workMap.get("paramsId_null"));
				Long paramsId_notNull = TypeCast.getLong(workMap.get("paramsId_notNull"));
				Long paramsId = TypeCast.getLong(workMap.get("paramsId"));
				Long paramsId_not = TypeCast.getLong(workMap.get("paramsId_not"));
				Long paramsId_greater = TypeCast.getLong(workMap.get("paramsId_greater"));
				Long paramsId_greaterEqual = TypeCast.getLong(workMap.get("paramsId_greaterEqual"));
				Long paramsId_less = TypeCast.getLong(workMap.get("paramsId_less"));
				Long paramsId_lessEqual = TypeCast.getLong(workMap.get("paramsId_lessEqual"));
				List<Long> paramsId_in = TypeCast.getLongList(workMap.get("paramsId_in"));
				List<Long> paramsId_notIn = TypeCast.getLongList(workMap.get("paramsId_notIn"));
				Long paramsId_between1 = TypeCast.getLong(workMap.get("paramsId_between1"));
				Long paramsId_between2 = TypeCast.getLong(workMap.get("paramsId_between2"));
				Long paramsId_notBetween1 = TypeCast.getLong(workMap.get("paramsId_notBetween1"));
				Long paramsId_notBetween2 = TypeCast.getLong(workMap.get("paramsId_notBetween2"));
				
				if(paramsId_null != null){
					c.andParamsIdIsNull();
				}
				if(paramsId_notNull != null){
					c.andParamsIdIsNotNull();
				}
				if(paramsId != null){
					c.andParamsIdEqualTo(paramsId);
				}
				if(paramsId_not != null){
					c.andParamsIdNotEqualTo(paramsId_not);
				}
				if(paramsId_greater != null){
					c.andParamsIdGreaterThan(paramsId_greater);
				}
				if(paramsId_greaterEqual != null){
					c.andParamsIdGreaterThanOrEqualTo(paramsId_greaterEqual);
				}
				if(paramsId_less != null){
					c.andParamsIdLessThan(paramsId_less);
				}
				if(paramsId_lessEqual != null){
					c.andParamsIdLessThanOrEqualTo(paramsId_lessEqual);
				}
				if(paramsId_in != null){
					c.andParamsIdIn(paramsId_in);
				}
				if(paramsId_notIn != null){
					c.andParamsIdNotIn(paramsId_notIn);
				}
				if(paramsId_between1 != null){
					c.andParamsIdBetween(paramsId_between1,paramsId_between2);
				}
				if(paramsId_notBetween1 != null){
					c.andParamsIdNotBetween(paramsId_notBetween1,paramsId_notBetween2);
				}
				Integer levelNum_null = TypeCast.getInteger(workMap.get("levelNum_null"));
				Integer levelNum_notNull = TypeCast.getInteger(workMap.get("levelNum_notNull"));
				Integer levelNum = TypeCast.getInteger(workMap.get("levelNum"));
				Integer levelNum_not = TypeCast.getInteger(workMap.get("levelNum_not"));
				Integer levelNum_greater = TypeCast.getInteger(workMap.get("levelNum_greater"));
				Integer levelNum_greaterEqual = TypeCast.getInteger(workMap.get("levelNum_greaterEqual"));
				Integer levelNum_less = TypeCast.getInteger(workMap.get("levelNum_less"));
				Integer levelNum_lessEqual = TypeCast.getInteger(workMap.get("levelNum_lessEqual"));
				List<Integer> levelNum_in = TypeCast.getIntegerList(workMap.get("levelNum_in"));
				List<Integer> levelNum_notIn = TypeCast.getIntegerList(workMap.get("levelNum_notIn"));
				Integer levelNum_between1 = TypeCast.getInteger(workMap.get("levelNum_between1"));
				Integer levelNum_between2 = TypeCast.getInteger(workMap.get("levelNum_between2"));
				Integer levelNum_notBetween1 = TypeCast.getInteger(workMap.get("levelNum_notBetween1"));
				Integer levelNum_notBetween2 = TypeCast.getInteger(workMap.get("levelNum_notBetween2"));
				
				if(levelNum_null != null){
					c.andLevelNumIsNull();
				}
				if(levelNum_notNull != null){
					c.andLevelNumIsNotNull();
				}
				if(levelNum != null){
					c.andLevelNumEqualTo(levelNum);
				}
				if(levelNum_not != null){
					c.andLevelNumNotEqualTo(levelNum_not);
				}
				if(levelNum_greater != null){
					c.andLevelNumGreaterThan(levelNum_greater);
				}
				if(levelNum_greaterEqual != null){
					c.andLevelNumGreaterThanOrEqualTo(levelNum_greaterEqual);
				}
				if(levelNum_less != null){
					c.andLevelNumLessThan(levelNum_less);
				}
				if(levelNum_lessEqual != null){
					c.andLevelNumLessThanOrEqualTo(levelNum_lessEqual);
				}
				if(levelNum_in != null){
					c.andLevelNumIn(levelNum_in);
				}
				if(levelNum_notIn != null){
					c.andLevelNumNotIn(levelNum_notIn);
				}
				if(levelNum_between1 != null){
					c.andLevelNumBetween(levelNum_between1,levelNum_between2);
				}
				if(levelNum_notBetween1 != null){
					c.andLevelNumNotBetween(levelNum_notBetween1,levelNum_notBetween2);
				}
			if(workMap.get("orderBy")!=null){
				workEx.setOrderByClause((String)workMap.get("orderBy"));
			}
			if(limitStart != null && limitOffset != null){
				workEx.setLimitStart(limitStart);
				workEx.setLimitOffset(limitOffset);
			}
			
			return workEx;
	}
}
